package com.story.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.story.dao.IAdminDao;
import com.story.domain.Admin;
import com.story.domain.Page;
import com.story.service.IAdminService;

@Service("adminService")
public class AdminServiceImpl implements IAdminService {
	@Autowired
	private IAdminDao adminDao;
	@Override
	public void addAdmin(Admin admin) {
		adminDao.createAdmin(admin);
	}

	@Override
	public Admin findOneByUsername(String username) {
		return adminDao.findAdminByUsername(username);
	}

	@Override
	public Boolean checkUsernameExisted(String username) {
		Admin admin = adminDao.findAdminByUsername(username);
		if(admin!=null){
			return true;
		}
		return false;
	}

	@Override
	public Integer getTotal() {
		return adminDao.getTotal();
	}

	@Override
	public List<Admin> findAdminsByLimit(Page page) {
		return adminDao.findAdminsByLimit(page);
	}

	@Override
	public Integer deleteOneById(String id) {
		// TODO Auto-generated method stub
		return adminDao.deleteAdminById(id);
	}

	@Override
	public Integer deleteSomeByIds(List<String> ids) {
		// TODO Auto-generated method stub
		return adminDao.deleteAdminsByIds(ids);
	}

}
